home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{5B494162-D2D9-11D1-A7C6-00C04FA30EBD}#1.0#0"; "DGroup.dll"
- Begin VB.Form Form1
- Caption = "DameWare Group Control Sample"
- ClientHeight = 6420
- ClientLeft = 5055
- ClientTop = 2940
- ClientWidth = 7635
- LinkTopic = "Form1"
- ScaleHeight = 6420
- ScaleWidth = 7635
- StartUpPosition = 2 'CenterScreen
- Begin VB.CommandButton Command12
- Caption = "Get Local Machine"
- Height = 375
- Left = 4080
- TabIndex = 7
- Top = 360
- Width = 1575
- End
- Begin VB.TextBox Text6
- Height = 405
- Left = 240
- TabIndex = 4
- Text = "Text6"
- Top = 3240
- Width = 2055
- End
- Begin VB.ListBox List1
- Height = 1815
- Left = 240
- Sorted = -1 'True
- TabIndex = 18
- Top = 4440
- Width = 7215
- End
- Begin VB.CommandButton Command11
- Caption = "Disconnect"
- Height = 375
- Left = 2400
- TabIndex = 17
- Top = 3960
- Width = 1575
- End
- Begin VB.TextBox Text5
- Height = 375
- Left = 240
- TabIndex = 3
- Text = "Text5"
- Top = 2520
- Width = 2055
- End
- Begin VB.CommandButton Command10
- Caption = "Get Current User"
- Height = 375
- Left = 5760
- TabIndex = 10
- Top = 1080
- Width = 1575
- End
- Begin VB.CommandButton Command9
- Caption = "Remove Member"
- Height = 375
- Left = 4080
- TabIndex = 15
- Top = 2520
- Width = 1575
- End
- Begin VB.CommandButton Command8
- Caption = "Add Member"
- Height = 375
- Left = 2400
- TabIndex = 14
- Top = 2520
- Width = 1575
- End
- Begin VB.CommandButton Command7
- Caption = "Connect"
- Height = 375
- Left = 2400
- TabIndex = 16
- Top = 3240
- Width = 1575
- End
- Begin VB.TextBox Text4
- Height = 375
- Left = 240
- TabIndex = 5
- Text = "Text4"
- Top = 3960
- Width = 2055
- End
- Begin VB.CommandButton Command6
- Caption = "Delete Group"
- Height = 375
- Left = 5760
- TabIndex = 13
- Top = 1800
- Width = 1575
- End
- Begin VB.CommandButton Command5
- Caption = "Add Group"
- Height = 375
- Left = 4080
- TabIndex = 12
- Top = 1800
- Width = 1575
- End
- Begin VB.CommandButton Command4
- Caption = "IsMember"
- Height = 375
- Left = 4080
- TabIndex = 9
- Top = 1080
- Width = 1575
- End
- Begin VB.CommandButton Command3
- Caption = "Get Group Users"
- Height = 375
- Left = 2400
- TabIndex = 11
- Top = 1800
- Width = 1575
- End
- Begin VB.TextBox Text3
- Height = 375
- Left = 240
- TabIndex = 2
- Text = "Text3"
- Top = 1800
- Width = 2055
- End
- Begin VB.CommandButton Command2
- Caption = "Get User Groups"
- Height = 375
- Left = 2400
- TabIndex = 8
- Top = 1080
- Width = 1575
- End
- Begin VB.CommandButton Command1
- Caption = "Get All Groups"
- Default = -1 'True
- Height = 375
- Left = 2400
- TabIndex = 6
- Top = 360
- Width = 1575
- End
- Begin VB.TextBox Text2
- Height = 375
- Left = 240
- TabIndex = 1
- Text = "Text2"
- Top = 1080
- Width = 2055
- End
- Begin VB.TextBox Text1
- Height = 375
- Left = 240
- TabIndex = 0
- Text = "Text1"
- Top = 360
- Width = 2055
- End
- Begin VB.Shape Shape1
- BackStyle = 1 'Opaque
- FillColor = &H00FFFFFF&
- FillStyle = 0 'Solid
- Height = 375
- Left = 6000
- Shape = 3 'Circle
- Top = 360
- Width = 495
- End
- Begin VB.Label Label7
- Caption = "Connect UserID"
- Height = 255
- Left = 240
- TabIndex = 26
- Top = 3000
- Width = 2055
- End
- Begin VB.Label Label6
- Alignment = 1 'Right Justify
- Caption = "Label6"
- Height = 255
- Left = 5880
- TabIndex = 25
- Top = 3960
- Width = 1575
- End
- Begin DGROUPLibCtl.DGroupCtl DGroupCtl1
- Height = 480
- Left = 7080
- TabIndex = 24
- Top = 120
- Width = 480
- _cx = 5080
- _cy = 5080
- Valid = -1 'True
- UserID = ""
- Group = ""
- Domain = ""
- GroupComment = ""
- ConnectUserID = ""
- ConnectPassword = ""
- End
- Begin VB.Label Label5
- Caption = "Group Comment"
- Height = 255
- Left = 240
- TabIndex = 23
- Top = 2280
- Width = 2055
- End
- Begin VB.Label Label4
- Caption = "Connect Password"
- Height = 255
- Left = 240
- TabIndex = 22
- Top = 3720
- Width = 2055
- End
- Begin VB.Label Label3
- Caption = "Group"
- Height = 255
- Left = 240
- TabIndex = 21
- Top = 1560
- Width = 2055
- End
- Begin VB.Label Label2
- Caption = "User ID"
- Height = 255
- Left = 240
- TabIndex = 20
- Top = 840
- Width = 1935
- End
- Begin VB.Label Label1
- Caption = "Domain or Machine Name"
- Height = 255
- Left = 240
- TabIndex = 19
- Top = 120
- Width = 2055
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Check1_Click()
- On Error GoTo ErrorHandler
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- End Sub
- Private Sub Command1_Click()
- On Error GoTo ErrorHandler
- List1.Clear
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.SetFirstGroup
- i = 0
- While DGroupCtl1.GroupGetNext <> 0
- List1.AddItem DGroupCtl1.Group + Chr(9) + DGroupCtl1.GroupComment
- i = i + 1
- Label6.Caption = "Count: " + Str(i)
- Label6.Refresh
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- 'Resume Next
- End Sub
- Private Sub Command10_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- Text2.Text = DGroupCtl1.GetCurrentUserID
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command11_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.UserDisconnect
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command12_Click()
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- Text1.Text = DGroupCtl1.GetLocalMachineName
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- End Sub
- Private Sub Command2_Click()
- On Error GoTo ErrorHandler
- Dim Count As Long
- List1.Clear
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.UserID = Text2.Text
- DGroupCtl1.SetFirstUserGroup
- i = 0
- While DGroupCtl1.UserGroupGetNext <> 0
- List1.AddItem DGroupCtl1.Group
- i = i + 1
- Label6.Caption = "Count: " + Str(i)
- Label6.Refresh
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command3_Click()
- On Error GoTo ErrorHandler
- List1.Clear
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.Group = Text3.Text
- DGroupCtl1.SetFirstUser
- i = 0
- While DGroupCtl1.UserGetNext <> 0
- List1.AddItem DGroupCtl1.UserID
- i = i + 1
- Label6.Caption = "Count: " + Str(i)
- Label6.Refresh
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command4_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- Form1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.UserID = Text2.Text
- DGroupCtl1.Group = Text3.Text
- If DGroupCtl1.IsMember = False Then
- MsgBox "User " + DGroupCtl1.UserID + " Is NOT Member of group " + Text3.Text
- MsgBox "User " + DGroupCtl1.UserID + " Is Member of group " + Text3.Text
- End If
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command5_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.Group = Text3.Text
- DGroupCtl1.GroupComment = Text5.Text
- DGroupCtl1.GroupAdd
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command6_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.Group = Text3.Text
- DGroupCtl1.GroupDelete
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command7_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.ConnectUserID = Text6.Text
- DGroupCtl1.ConnectPassword = Text4.Text
- DGroupCtl1.UserConnect
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command8_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.UserID = Text2.Text
- DGroupCtl1.Group = Text3.Text
- DGroupCtl1.GroupAddMember
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Command9_Click()
- On Error GoTo ErrorHandler
- Shape1.FillColor = &H80FFFF 'yellow busy
- Shape1.Refresh
- DGroupCtl1.Domain = Text1.Text
- DGroupCtl1.UserID = Text2.Text
- DGroupCtl1.Group = Text3.Text
- DGroupCtl1.GroupRemoveMember
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- Shape1.FillColor = &HFF& ' red - failed
- Shape1.Refresh
- End Sub
- Private Sub Form_Load()
- On Error GoTo ErrorHandler
- Text1.Text = DGroupCtl1.GetLocalMachineName
- Text2.Text = DGroupCtl1.GetCurrentUserID
- Text3.Text = ""
- Text4.Text = ""
- Text5.Text = ""
- Text6.Text = DGroupCtl1.GetCurrentUserID
- Label6.Caption = "Count: "
- Shape1.FillColor = &H80FF80 ' green - returned ok
- Shape1.Refresh
- Exit Sub
- ErrorHandler:
- OnErrorHandler
- 'Resume Next
- End Sub
- Sub OnErrorHandler()
- If Err.Number <> 0 Then
- MsgBox Err.Description, , "Error"
- End If
- End Sub
-